import React, { Component } from 'react';
import { connect } from 'dva';
import { Row, Col } from 'antd';
import G6Graph from '@/components/G6Graph';
import styles from './index.less';

@connect(({ commonModel }) => ({ ...commonModel }))
class G6GraphDemo extends Component {
  componentDidMount() {
    this.fetch();
  }

  fetch = () => {
    const { dispatch } = this.props;
    dispatch({
      type: 'commonModel/query',
      targetKey: 'g6Graph',
    });
  };

  render() {
    const { g6Graph } = this.props;
    return (
      <Row>
        <Col span={12} className={styles.g6GraphBg}>
          <G6Graph jsonData={g6Graph} />
        </Col>
      </Row>
    );
  }
}

export default G6GraphDemo;
